<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class CreateNaturalSpellingTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('natural_spelling', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('mechanism_id')->default(0)->comment('机构 id');
            $table->unsignedInteger('book_id')->default(0)->comment('教材 id');
            $table->unsignedInteger('unit_id')->default(0)->comment('单元 id');
            $table->string('name', 30)->default('')->comment('拼读名称');
            $table->longText('data')->comment('拼读数据');
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `natural_spelling` comment '自然拼读表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('natural_spelling');
    }
}
